import 'package:sqlite3/sqlite3.dart';

void main() {
  // 打开内存数据库
  final db = sqlite3.openInMemory();

  // 创建表
  db.execute('''
    CREATE TABLE users (
      id INTEGER PRIMARY KEY,
      name TEXT NOT NULL
    );
  ''');

  // 插入数据
  db.execute('INSERT INTO users (name) VALUES ("Alice")');
  db.execute('INSERT INTO users (name) VALUES ("Bob")');

  // 查询数据
  final result = db.select('SELECT * FROM users');
  for (final row in result) {
    print('User: id=${row['id']}, name=${row['name']}');
  }

  // 关闭数据库
  db.dispose();
}


